/************************************************************************
 * The code is owned by mainframer.cn and Shang Tao
 * Without aproval of mainframer.cn and Shang Tao, removing the copyright
 * infomation is regarded as invassion of proprietary copyright
 ***********************************************************************/
package com.mr.qa.dao.impl;

import java.util.Date;

import junit.framework.TestCase;

import org.hibernate.Transaction;

import com.mr.qa.bo.User;
import com.mr.qa.bo.UserScore;
import com.mr.qa.util.HibernateSessionFactory;

public class UserDAOTest extends TestCase {

	public UserDAOTest(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
		
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testSave() {
		UserDAO userDAO = new UserDAO();
		Transaction tx = null;
		try {
			tx = HibernateSessionFactory.getSession().beginTransaction();
			//User user = new User("name", "pwd", "1", new Date(), new Date());

			User user2 = new User();
			user2.setLoginName("loginName1");
			user2.setPassword("password2");
			user2.setName("name3");
			user2.setSignature("s");
			user2.setMobile("123");
			user2.setEmail("email2");
			
			user2.setState("1");
			
			user2.setType("2");
			
			user2.setLastLoginDate(new Date());
			user2.setRegisterDate(new Date());


			UserScore score = new UserScore();

			score.setTitle("t");
			score.setTotalScore(new Integer(100));
			
			user2.setUserScore(score);
			
			score.setMrIaskUser(user2);

			userDAO.save(user2);
			
			tx.commit();

		} catch (RuntimeException re) {
			re.printStackTrace();
		} finally {
			if (tx != null) {
				tx.rollback();
			}
		}

	}

	public void testDelete() {
		fail("Not yet implemented");
	}

	public void testFindById() {
		fail("Not yet implemented");
	}

	public void testFindByExample() {
		fail("Not yet implemented");
	}

	public void testFindByProperty() {
		fail("Not yet implemented");
	}

	public void testFindByLoginName() {
		fail("Not yet implemented");
	}

	public void testFindByPassword() {
		fail("Not yet implemented");
	}

	public void testFindByName() {
		fail("Not yet implemented");
	}

	public void testFindBySignature() {
		fail("Not yet implemented");
	}

	public void testFindByMobile() {
		fail("Not yet implemented");
	}

	public void testFindByEmail() {
		fail("Not yet implemented");
	}

	public void testFindByState() {
		fail("Not yet implemented");
	}

	public void testFindByType() {
		fail("Not yet implemented");
	}

	public void testMerge() {
		fail("Not yet implemented");
	}

	public void testAttachDirty() {
		fail("Not yet implemented");
	}

	public void testAttachClean() {
		fail("Not yet implemented");
	}

}
